package org.example.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.pojo.Student;
import org.example.pojo.StudentQueryParm;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {
    /**
     * 分页查询
     */
    public List<Student> findByPage(StudentQueryParm studentQueryParm);

    /**
     * 删除学员
     * @param ids
     */
    void deleteByIds(List<Integer> ids);

    /**
     * 添加学员
     * @param student
     */
    void insert(Student student);

    /**
     * 根据id查询学员
     * @param id
     * @return
     */
    Student findById(Integer id);

    /**
     * 修改员工
     * @param student
     */

    void update(Student student);
    // 修改学员的违纪次数和违纪分数
    void updateViolation(Integer id, Short score);
    // 根据班级id查询学员人数
    @Select("select count(*) from student where clazz_id = #{id}")
    int findCountByClazzId(Integer id);

    /**
     * 获得学员学历数据
     * @return
     */

    List<Map<String, Object>> getStudentDegreeData();

    /**
     * 获得班级人数数据
     * @return
     */
    List<Map<String, Object>> getStudentCountData();
}
